using Core;
using EnvDTE;

namespace RevisionItNow.Features
{
	public class AutoOpenForDeleteFeature : Feature
	{
		private readonly ProjectItemsEvents _events;

        public AutoOpenForDeleteFeature(Ide ide, OutputPane outputPane)
			: base("Auto Open For Delete", ide, outputPane)
		{
			_events = ide.ProjectItemsEvents;

			if (_events != null)
				_events.ItemRemoved += OnItemRemoved;
		}

		public void OnItemRemoved(ProjectItem projectItem)
		{
			Mercurial.Delete(projectItem.FileNames[0]);
		}
	}
}